﻿$(function () {
    var myv = new Vue({
        el: "#InfoList",
        data: {
            CommodityInfo: []
        }
    });

    $(function () {
        (function () {
            $.post("/GMShopMethod/CommodityInfoCount", { typeName: $("#PageName").text(), count: 0 }, function (date) {
                myv.$data.CommodityInfo = date;
            });
        })();
    })

    $("#InfoList").on("click", ".ListImage", function () {
        location = "/GMShop/CommodityInfo?Cid=" + $(this).attr("id");
    });

    $("#AddShopCar").click(function () {
        //获取选择的物品
        var arr = $(".SelectItem");
        var addArr = new Array();
        var j = 0
        for (var i = 0; i < arr.length; i++) {
            if ($(arr[i]).prop("checked")) {
                addArr[j] = $(".InfoID").eq(i).text();
                j++;
            }
        }
        console.log(addArr);
        $.post("/GMShopMethod/ShopingCar", { arr: addArr }, function (date) {
            alert(date.Massage);
            if (date.State == 10) {
                location = "/GMShop/LogIn";
            } else {

            }
        });
    });
});